/* 全局变量定义 */
:root {
    --primary-color: #2563eb;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --error-color: #ef4444;
    --background-color: #f8fafc;
    --surface-color: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --text-muted: #94a3b8;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
    --border-radius: 0.5rem;
    --border-radius-sm: 0.375rem;
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    --font-mono: 'Monaco', 'Consolas', 'Ubuntu Mono', monospace;
}

/* 重置样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background-color: var(--background-color);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

/* 容器样式 */
.container {
    max-width: 100vw;
    width: 100%;
    padding: 1rem;
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* 头部样式 */
header {
    text-align: center;
    margin-bottom: 1.5rem;
    padding: 1rem 0;
}

header h1 {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
}

header .subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
}

/* 主内容区域 */
main {
    flex: 1;
    display: flex;
    gap: 1rem;
    width: 100%;
}

/* 输入和输出区域 */
.input-section,
.output-section {
    flex: 1;
    min-width: 0; /* 防止flex子元素溢出 */
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    min-height: 500px;
    margin: 0;
}

/* 左侧输入区域特殊样式 */
.input-section {
    display: flex;
    flex-direction: column;
}

.input-section .button-container {
    margin-top: 1rem;
    margin-bottom: 0;
    padding-top: 0;
}

.input-section h2,
.output-section h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 1.25rem;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* 表单样式 */
.form-group {
    margin-bottom: 0.75rem;
}

/* 类路径输入框样式优化 */
#classPath.form-control {
    max-height: 2.5rem;
    background-color: #fafafa;
    border: 1px solid #e0e0e0;
    transition: all 0.3s ease;
}

#classPath.form-control:focus {
    background-color: #ffffff;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group label {
    display: block;
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    font-size: 0.875rem;
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    font-size: 0.875rem;
    font-family: var(--font-mono);
    transition: border-color 0.2s, box-shadow 0.2s;
    background-color: var(--surface-color);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

textarea.form-control {
    min-height: 380px;
    resize: vertical;
    line-height: 1.5;
    flex: 1;
    background-color: #fafafa;
    border: 1px solid #e0e0e0;
    transition: all 0.3s ease;
}

textarea.form-control:focus {
    background-color: #ffffff;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1), 0 2px 8px rgba(0, 0, 0, 0.05);
}

/* 提升整体界面美观性 */
.input-section,
.output-section {
    border-radius: 8px;
    border: 1px solid #e0e0e0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    transition: all 0.3s ease;
    overflow: hidden;
}

.input-section:hover,
.output-section:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
    transform: translateY(-1px);
}

/* 美化标题样式 */
.input-section h2,
.output-section h2 {
    font-weight: 600;
    letter-spacing: -0.01em;
    background: linear-gradient(135deg, var(--primary-color), #3b82f6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* 美化标签样式 */
.form-group label {
    font-weight: 500;
    color: #374151;
    font-size: 0.875rem;
    letter-spacing: 0.02em;
}

/* 按钮样式 */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: var(--border-radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    gap: 0.5rem;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background-color: #1d4ed8;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: white;
    font-size: 0.75rem;
    padding: 0.5rem 1rem;
}

.btn-secondary:hover:not(:disabled) {
    background-color: #475569;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 输出区域样式 */
.empty-state,
.loading-state,
.error-state {
    text-align: center;
    padding: 2rem 1rem;
}

.empty-state i,
.error-state i {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    opacity: 0.5;
}

.empty-state h3,
.error-state h3 {
    font-size: 1.125rem;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.empty-state p,
.error-state p {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* 按钮容器样式 */
.button-container {
    display: flex;
    justify-content: center;
    margin-top: 0.75rem;
    margin-bottom: 0.5rem;
    width: 100%;
    box-sizing: border-box;
}

.button-container .btn-primary {
    font-size: 1rem;
    padding: 0.75rem 1.5rem;
    width: auto;
    min-width: 150px;
}

.error-state {
    color: var(--error-color);
}

.error-state i {
    opacity: 0.7;
}

.loading-state {
    color: var(--text-secondary);
}

.loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    margin: 0 auto 0.75rem;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* 结果区域样式 */
.result-state {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    overflow: hidden;
}

.code-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    background: var(--background-color);
    border-bottom: 1px solid var(--border-color);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-secondary);
}

pre {
    margin: 0;
    padding: 0;
    background: #1e293b;
    border-radius: 0;
}

code {
    display: block;
    padding: 1rem;
    font-family: var(--font-mono);
    font-size: 0.8125rem;
    line-height: 1.5;
    overflow-x: auto;
    color: #e2e8f0;
}

/* 底部样式 */
footer {
    text-align: center;
    padding: 1.5rem 0;
    color: var(--text-muted);
    border-top: 1px solid var(--border-color);
    margin-top: 2rem;
    font-size: 0.875rem;
}

/* 响应式设计 */
@media (max-width: 1024px) {
    .container {
        padding: 0.75rem;
    }
    
    main {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .input-section,
    .output-section {
        padding: 1.25rem;
        min-height: auto;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0.5rem;
    }
    
    header h1 {
        font-size: 1.75rem;
    }
    
    header .subtitle {
        font-size: 0.875rem;
    }
    
    .input-section,
    .output-section {
        padding: 1rem;
    }
    
    .input-section h2,
    .output-section h2 {
        font-size: 1.125rem;
        margin-bottom: 1rem;
    }
    
    textarea.form-control {
        min-height: 250px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0.25rem;
    }
    
    .input-section,
    .output-section {
        padding: 0.75rem;
    }
    
    .form-control {
        font-size: 0.8125rem;
    }
    
    code {
        font-size: 0.75rem;
    }
}